﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:styles="clr-namespace:tomenglertde.ResXManager.Styles">

  <Style x:Key="{x:Static styles:ResourceKeys.GroupBoxStyle}" TargetType="{x:Type GroupBox}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderThickness" Value="0,1,0,0" />
    <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type GroupBox}">
          <DockPanel>
            <Grid DockPanel.Dock="Top">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="8" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
              </Grid.ColumnDefinitions>
              <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
              </Grid.RowDefinitions>

              <Border Grid.Row="1" Grid.Column="0"
                      BorderBrush="{TemplateBinding BorderBrush}"
                      BorderThickness="{TemplateBinding BorderThickness}" />

              <Border Grid.Row="1" Grid.Column="2"
                      BorderBrush="{TemplateBinding BorderBrush}"
                      BorderThickness="{TemplateBinding BorderThickness}" />

              <Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
                      Background="{TemplateBinding Background}" />

              <Border Background="{TemplateBinding Background}" Grid.Row="0" Grid.RowSpan="3" Grid.Column="1">
                <ContentPresenter ContentSource="Header" Margin="3,1"
                                  TextBlock.Foreground="{TemplateBinding Foreground}"
                                  ContentStringFormat="{TemplateBinding HeaderStringFormat}"
                                  ContentTemplate="{TemplateBinding HeaderTemplate}"
                                  RecognizesAccessKey="True"
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
              </Border>
            </Grid>

            <Border Padding="5,1" Background="{TemplateBinding Background}">
              <ContentPresenter Margin="{TemplateBinding Padding}"
                                Content="{TemplateBinding Content}"
                                ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            </Border>
          </DockPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>